//============================================================================
// Copyright (C) 2003-2013 Brett R. Jones 
// All Rights Reserved
//
// You may redistribute and/or modify for non commercial and commercial uses 
// provided this copyright notice remains in place and is not modified
//
// This code is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// brettjones1900@gmail.com
// http://www.p2panarchy.com
//============================================================================
typedef struct 
{
	U16		u16ItemCnt;	// number of bought item
	U32		u32SnItem;	// serial of item
}BuyItemStruct;

// show or buy items from vendor
class PktBuy : public VxPktHdr
{
public:
	PktBuy()
	{
		m_u16PktType = PKT_TYPE_BUY;
	}
	void CalcLen( U16 u16ItemCnt )
	{
		//calculate length of packet from number of items bought
		m_u16PktLen = ROUND_TO_16BYTE_BOUNDRY( ( sizeof( PktBuy ) - (PKT_MAX_BUY_CNT * sizeof( BuyItemStruct )) +  (u16ItemCnt * sizeof( BuyItemStruct ))) );
	}
	U32 u32SnVendor;
	U16 u16BuyCnt; // number bought or shown item stacks
	U16 u16Res1; // reserved for alignment
	BuyItemStruct agItems[ PKT_MAX_BUY_CNT ];
};